home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’96
/
MenuHack
/
MenuHackSource.sit
/
jGNELib.c
< prev
next >
Wrap
Text File
|
1996-06-21
|
2KB
|
91 lines
/*------------------------------------------------------------------------------
#
# jGNEFilter Code Resource Library
#
# This routine loads a small 68K resource that acts as a "safe" jGNEFilter connector (allows
# hooking and unhooking at will.
#
# Copyright © CE Software, Inc., Inc. 1996
# All rights reserved.
#
------------------------------------------------------------------------------*/
#include <Gestaltequ.h>
#include <Limits.h>
#include <Types.h>
#include <Resources.h>
#include <QuickDraw.h>
#include <Fonts.h>
#include <Events.h>
#include <Windows.h>
#include <Menus.h>
#include <TextEdit.h>
#include <Dialogs.h>
#include <Desk.h>
#include <ToolUtils.h>
#include <Memory.h>
#include <SegLoad.h>
#include <Files.h>
#include <OSUtils.h>
#include <OSEvents.h>
#include <Traps.h>
#include "jGNELib.h"
typedef pascal void (*jGNEProcActionProcPtr)(short theAction,
long thejGNEProc,
long refcon);
typedef pascal void (*jGNEProcInitProcPtr)(void);
jGNEProcActionProcPtr gTheProc = nil;
void InitjGNEProcLib(void)
{
OSErr err;
Handle thecodeproc;
err = Gestalt('jGNE', (long*)&gTheProc);
if (err)
{
gTheProc = nil;
thecodeproc = GetResource('CECD', 10);
if (thecodeproc)
{
((jGNEProcInitProcPtr)(*thecodeproc))();
}
}
}
void HookjGNE(long thejGNEProc, long refcon)
{
OSErr err;
if (!gTheProc)
{
err = Gestalt('jGNE',(long*) &gTheProc);
if (err || !gTheProc)
{
return;
}
}
gTheProc(1, thejGNEProc, refcon);
}
void UnHookjGNE(void)
{
OSErr err;
if (!gTheProc)
{
err = Gestalt('jGNE', (long*)&gTheProc);
if (err || !gTheProc)
{
return;
}
}
gTheProc(2, 0, 0);
}